package com.wiscamp.ninechapters.problems.domain.models.problems.answers;


import com.wiscamp.ninechapters.problems.enums.AnswerTypes;
import com.wiscamp.ninechapters.problems.math.LatexDate;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 日期答案
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class DateAnswer extends Answer {
    /**
     * 答案值
     */
    private LatexDate value;

    public DateAnswer(long answerId, long questionId, int answerIndex, int groupIndex, LatexDate value) {
        setAnswerType(AnswerTypes.DATE);
        this.value = value;
        setAnswerId(answerId);
        setQuestionId(questionId);
        setAnswerIndex(answerIndex);
        setGroupIndex(groupIndex);
        setAnswerTypeId(this.getAnswerType().getValue());
    }

    @Override
    public String getAnswerText() {
        //this.setContentHypertext(value.getLatex());
        return value.getLatex();
    }

    /*@Override
    public boolean compareAnswer(String contentText) {
        var sheetAnswerDate = LocalDate.parse(contentText);
        var correctAnswerDate = value.getDate();

        if (sheetAnswerDate.getYear() != correctAnswerDate.getYear()
        || sheetAnswerDate.getMonth() != correctAnswerDate.getMonth()
        || sheetAnswerDate.getDayOfMonth() != correctAnswerDate.getDayOfMonth())
        {
            return false;
        }
        return true;
    }*/
}
